<%@ page import="service.serviceimpl.ServiceUserImpl" %>
<%@ page import="entity.Userinfo" %>
<%@ page import="java.util.List" %>
<%@ page contentType="text/html;charset=UTF-8" language="java" %>
<html>
<head>
    <title>Title</title>
    <style>
        table{
            display: block;
            width: 400px;
            margin: auto;
        }p{
             width: 100px;
             margin: auto;
         }p{
            color: red;
                           }
    </style>
</head>
<body>
<table border="4">
    <tr><th>人员列表</th></tr>
    <tr>
        <th>id</th>
        <th>name</th>
        <th>sex</th>
        <th>age</th>
        <th>ranking</th>
        <th>dept</th>
        <th>操作</th>
    </tr>
    <%
        ServiceUserImpl serviceUser = new ServiceUserImpl();
        List<Userinfo> userinfos = serviceUser.executeQuery("select * from userinfo");
    %>
    <%for(Userinfo xjj : userinfos){%>
    <tr>
        <td><%=xjj.getId()%></td>
        <td><%=xjj.getName()%></td>
        <td><%=xjj.getSex()==1?"男":"女"%></td>
        <td><%=xjj.getAge()%></td>
        <td><%=xjj.getRanking()%></td>
        <td><%=xjj.getDept()%></td>
        <td>
            <a href="controller.jsp?op=delete&id=<%=xjj.getId()%>"> <input class="delete" type="button" value="删除"></a>
            <a href="controller.jsp?op=update1&id=<%=xjj.getId()%>">修改</a>
        </td>
    </tr>
    <%}%>
</table>
<p> <a href="add.jsp"> <input  type="button" value=增加></a>
</p>
<p><%=request.getParameter("feifa")==null?"":"非法入侵"%></p>
<p><%=request.getParameter("delete1")==null?"":"删除成功"%></p>
<p><%=request.getParameter("delete2")==null?"":"删除失败"%></p>
<p><%=request.getParameter("add1")==null?"":"增加成功"%></p>
<p><%=request.getParameter("add2")==null?"":"增加失败"%></p>
<p><%=request.getParameter("update1")==null?"":"修改成功"%></p>
<p><%=request.getParameter("update2")==null?"":"修改失败"%></p>

<script src="https://cdnjs.cloudflare.com/ajax/libs/jquery/3.5.1/jquery.min.js"></script>
<script>
    $("table").css("background-color","yellow");
    $("tr:odd").css("background-color","green");
    $(".delete").click(function () {
        if(confirm("删除吗？")){

        }else{
            return false;//把按钮卡死
        }
    });
</script>
</body>
</html>
